package com.label.grade.entity.Do;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

/**
 * 培养计划表
 * @TableName ACADEMIC_PROGRAM
 */
@Data
public class AcademicProgram extends Model<AcademicProgram> implements Serializable {
    /**
     * 课程ID
     */
    private Long id;

    /**
     * 课程所属专业
     */
    private String major;

    /**
     * 年级
     */
    private String grade;

    /**
     * 课程名称
     */
    private String courseName;

    /**
     * 课程性质
     */
    private String courseAttribute;

    /**
     * 课程类型
     */
    private String courseType;

    /**
     * 课程类型分类
     */
    private String courseTypeCategory;

    /**
     * 学期1-1
     */
    private String semester11;

    /**
     * 学期1-2
     */
    private String semester12;

    /**
     * 学期2-1
     */
    private String semester21;

    /**
     * 学期2-2
     */
    private String semester22;

    /**
     * 学期3-1
     */
    private String semester31;

    /**
     * 学期3-2
     */
    private String semester32;

    /**
     * 学期4-1
     */
    private String semester41;

    /**
     * 学期4-2
     */
    private String semester42;

    /**
     * 授课单位
     */
    private String teachingUnit;

    /**
     *
     */
    private String createBy;

    /**
     *
     */
    private Date createTime;

    /**
     *
     */
    private Date updateTime;

    /**
     *
     */
    private String updateBy;

    /**
     *
     */
    private String remark;

    /**
     * 学分
     */
    private Double credit;

    /**
     * 总学时
     */
    private Double totalHours;

    /**
     * 授课学时
     */
    private Double lectureHours;

    /**
     * 实践学时
     */
    private Double practiceHours;

    /**
     * 实验学时
     */
    private Double experimentHours;

    /**
     * 上机学时
     */
    private Double computerHours;

    /**
     * 考试类别
     */
    private String examCategory;

    @TableField(exist = false)
    private String semester;

    private static final long serialVersionUID = 1L;

    public void setSemester(){
        Map<String, String> semesterMap = new HashMap<>();
        semesterMap.put(this.semester11, "第1学年第1学期");
        semesterMap.put(this.semester12, "第1学年第2学期");
        semesterMap.put(this.semester21, "第2学年第1学期");
        semesterMap.put(this.semester22, "第2学年第2学期");
        semesterMap.put(this.semester31, "第3学年第1学期");
        semesterMap.put(this.semester32, "第3学年第2学期");
        semesterMap.put(this.semester41, "第4学年第1学期");
        semesterMap.put(this.semester42, "第4学年第2学期");
        String semester = "";
        String credit = "";

        for (Map.Entry<String, String> entry : semesterMap.entrySet()) {
            String sem = entry.getKey();
            if (sem != null && !sem.isEmpty()) {
                this.semester = entry.getValue();
                break;
            }
        }
        Map<String, String> map = new HashMap<>();
        map.put("semester",semester);
        map.put("credit",credit);
    }

    public int getSemesterInt(){
        if (this.semester == null)return -1;
        if (this.semester == "第1学年第1学期")return 0;
        if (this.semester == "第1学年第2学期")return 1;
        if (this.semester == "第2学年第1学期")return 2;
        if (this.semester == "第2学年第2学期")return 3;
        if (this.semester == "第3学年第1学期")return 4;
        if (this.semester == "第3学年第2学期")return 5;
        if (this.semester == "第4学年第1学期")return 6;
        if (this.semester == "第4学年第2学期")return 7;
        return -1;
    }
}
